﻿#ifndef TOUCHSREEN_H
#define TOUCHSREEN_H

#include<cstring>
#include <iostream>

extern "C" {
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>  //open
#include <linux/input.h>
#include <unistd.h> //sleep close
}

class TouchSreen {
  public:
    TouchSreen(const char*deviceName = "/dev/input/event0");
    ~TouchSreen();

    int waitTouch(int&x, int&y);
    void narrowDown(int &x, int &y);  // 缩小范围，触摸屏获取的数值是[1024,600]，要缩小到[800,480]
  private:
    char m_deviceName[256];

    int touchFd;
};

#endif // TOUCHSREEN_H
